<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>2:实现类似田径比赛上的计时功能，点击 开始 按钮开始计时，点击 结束按钮 停止及时，
			同时页面上显示计时的秒数（以0.01秒为最小间隔单位）</title>
		<script>
			var tim = 0;
			var times;

			function start() {
				clearInterval(times);
				times = setInterval(function() {
					tim += 0.01;
					document.getElementById("sj").innerHTML = tim.toFixed(2) + "秒";
				}, 10);
			}

			function stop() {
				clearInterval(times);
			}

			function reset() {
				clearInterval(times);
				tim=0;
				document.getElementById("sj").innerHTML = "0.00秒";
			}
		</script>
	</head>
	<body>
		<div>
			<h2 id="sj">0.00秒</h2>
			<button onclick="start()">开始计时</button>
			<button onclick="reset()">重置</button>
			<button onclick="stop()">停止计时</button>
		</div>
	</body>
</html>
